package com.teziyou.commodity.util;

import java.util.Date;

import org.apache.commons.lang3.StringUtils;

public class Lang {
	
	public static int toInt(Object obj) {
		return obj==null||StringUtils.isBlank(obj+"")?0:Integer.parseInt(obj+"");
	}
	
	public static String toString(Object obj) {
		return obj==null?"":obj+"";
	}
	
	public static long toLong(Object obj) {
		return obj==null||StringUtils.isBlank(obj+"")?0l:Long.parseLong(obj+"");
	}
	
	public static Date toDate(Object obj) {
		return obj==null?new Date():(Date)obj;
	}

}
